|
|
|
| |
|
|
|
|
Make sure that you have set the Microsoft DAO 3.5 object library before performing the exercises in this chapter. This can be done by selecting Project from the main menu, then choosing Preferences. Find the option for the object library in the dialog that appears and then press OK. |
|
|
|
|
|
|
|
|
|
|
Now, double-click the command button and enter the code from Listing 20.1 in its Click event. |
|
|
|
|
|
|
|
|
Listing 20.1. Visual Basic code for the Create Master command button. |
|
|
|
|
|
|
|
|
Private Sub cmdCreateMaster_Click()
Dim dbMaster As Database
Dim repProperty As Property
'Open the database in exclusive mode
Set dbMaster = OpenDatabase("c:\tysdbvb5\source\data\replmast.mdb", True)
'Create and set the replicable property
Set repProperty = dbMaster.CreateProperty("Replicable", dbText, "T")
dbMaster.Properties.Append repProperty
dbMaster.Properties("Replicable") = "T"
'Display a message box
MsgBox "You have created a Design Master!"
End Sub |
|
|
|
|
|
|
|
|
This code opens the REPLMAST.MDB exclusively, creates the Replicable property and appends it to the database, and then sets the Replicable property to T. Please note that you must first create this property because it does not exist in a standard database. |
|
|
|
|
| |
|
|
|
|
Always make a backup copy of your database before converting it into a Design Master. Once the Design Master is created and data changes are made, destroy the copy. Later today you will see that making and using backup copies of the Design Master is dangerous business. |
|
|
|
|
|
|
|
|
|
|
Add a second command button and name it cmdExit, and use E&xit as the caption. Enter the code from Listing 20.2 into the Click event of this project. |
|
|
|
|
|